class Customer extends Person {

    Membership membership
    Long point = 0
    String cardNumber
    BigDecimal balance = 0
    static hasMany = [jobs: Job, pays:Pay]
    static fetchMode = [membership: "eager"]
    static transients = ['member']

    String toString() {
        return name
    }

    static mapping = {
        cache true
        membership cache: true
        /*jobs cache: true
        pays cache: true*/
    }

    boolean isMember() {
        return membership.discount < 1
    }

    static constraints = {
        cardNumber(nullable:true)
    }

}

